﻿<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title>订单查看</title>
<link rel="stylesheet" href="../assets/css/indexModel.css" />
<link rel="stylesheet" href="../assets/css/regist.css" />
<link rel="stylesheet" href="../assets/css/order.css" />
<script src="../assets/js/jquery-1.8.3.min.js"></script>
<!-- <script src="../assets/js/orderList.js"></script> -->
<style>
    .hiddenInfo {
            display: none;
        }
</style>
</head>
<body>
	<div class="main">
		<div class="content">
			<div class="title">
				<a class="before">＜</a>废品回收订单列表
			</div>
			
			<div class="hiddenInfo">
			
			</div>
		</div>
	</div>
	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
	<script type="text/javascript">
		$(function() {
			$.ajax({
				type : 'get',
				url : "/fgd/order/getOrderList",
				success : function(data) {
					for (var i = 0; i < data.length; i++) {
						$(".content").
						append(
						"<div><span > "
								+ data[i].createTime
								+ "</span>回收金额:￥<span>"
								+ data[i].money
								+ "</span>分<span>"
								+ data[i].dictText
								+ "</span> <button class='select' oid="+data[i].ordeNo+"> >> </button> </div>");
/* 	+ "</span> <a href='javascript:void(0);' class='right bg down select' oid="+data[i].ordeNo+"></a> </div>"); */
										
									}
								},
								error : function() {
									alert("No")
								},
								async : false
							})
				})();
		
				
		 $(".select").on("click", function () {
			 alert("come in")
		        var oid = $(this).attr("oid");
		        $.ajax({
		            type: "post",
		            url: "/fgd/order/getOrderDetail",
		            data: {oid:oid},
		            success: function (data) {
		               alert("xianshi");
		               alert(date.scStatus)
		                $(".hiddenInfo").show();
		              /*  if(date.scStatus=="sc_1"){//如果已回收则只读 */
		   					$(".hiddenInfo").append("<form id='form1'>");
							$(".hiddenInfo").append("<div>订单编号:<input type='text' value='"+data[i].ordeNo+"' name='ordeNo' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品名称:<input type='text' value='"+data[i].scrapName+"' name='scrapName' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品编号:<input type='hidden' value='"+data[i].scraCode+"' name='scraCode' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>业主名称:<input type='text' value='"+data[i].owName+"' name='owName' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>业主编号:<input type='hidden' value='"+data[i].ownerId+"' name='ownerId' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品回收员姓名:<input type='text' value='"+data[i].scName+"' name='scName' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品回收员编号:<input type='hidden' value='"+data[i].scId+"' name='scId' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收单位:<input type='text' value='"+data[i].unit+"' name='unit' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收价格:<input type='text' value='"+data[i].price+"' name='price' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收数量:<input type='text' value='"+data[i].amount+"' name='amount' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收金额(分):<input type='text' value='"+data[i].money+"' name='money' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收状态:<input type='text' value='"+data[i].dictText+"' name='dictText' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收状态编号:<input type='hidden' value='"+data[i].scStatus+"' name='scStatus' readonly='readonly' /></div>");
							$(".hiddenInfo").append("</form>"); 
		             /*   }else(){//如果未回收则让回收员提交订单 */
		            	   $(".hiddenInfo").append("<form>");
							$(".hiddenInfo").append("<div>订单编号:<input type='text' value='"+data[i].ordeNo+"' name='ordeNo' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品名称:<input type='text' value='"+data[i].scrapName+"' name='scrapName' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品编号:<input type='hidden' value='"+data[i].scraCode+"' name='scraCode' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>业主名称:<input type='text' value='"+data[i].owName+"' name='owName' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>业主编号:<input type='hidden' value='"+data[i].ownerId+"' name='ownerId' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品回收员姓名:<input type='text' value='"+data[i].scName+"' name='scName' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>废品回收员编号:<input type='hidden' value='"+data[i].scId+"' name='scId' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收单位:<input type='text' value='"+data[i].unit+"' name='unit' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收价格:<input type='text' value='"+data[i].price+"' name='price' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收数量:<input type='text' value='"+data[i].amount+"' name='amount' id='num'/></div>");
							$(".hiddenInfo").append("<div id='count'>回收金额(分):<input type='text' value='' name='money' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收状态:<input type='text' value='"+data[i].dictText+"' name='dictText' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<div>回收状态编号:<input type='hidden' value='"+data[i].scStatus+"' name='scStatus' readonly='readonly' /></div>");
							$(".hiddenInfo").append("<input type='button id='b' value='完成订单''/>");
							$(".hiddenInfo").append("</form>");
		               }
		            },
		            error: function () {
		            	alert("cuowu");
		            }
		        })
		    }); 
		 $("#num").on("blur", function () {
			 var price = $("[name=price]").val();
			 var amount = $("[name=amount]").val();
			 $.ajax({
			        type: "post",
			        url: "/fgd/order/count",
			        data: {price: price,amount:amount},
			        success: function (data) {
			        	  $("#count").attr('value',data)  
			        },
			        error: function () {
			        }
			 })
		 }
		 $("#b").on("clik", function () {
			 $.ajax({
			        type: "post",
			        url: "/fgd/order/add",
			        data: $('#form1').serialize(),,
			        success: function (data) {
			        	
			        },
			        error: function () {
			        }
			 })
		 }
		 
	</script>

</body>
</html>